/**
 * Licensee: 
 * License Type: Evaluation
 */
package ormsamples;

import org.orm.*;
public class ListPrueba1Data {
	private static final int ROW_COUNT = 100;
	
public void listTestData() throws PersistentException {
		orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
		System.out.println("Listing Com_log...");
		orm.Com_log[] ormCom_logs = lDAOFactory.getCom_logDAO().listCom_logByQuery(null, null);
		int length = Math.min(ormCom_logs.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormCom_logs[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Com_precio...");
		orm.Com_precio[] ormCom_precios = lDAOFactory.getCom_precioDAO().listCom_precioByQuery(null, null);
		length = Math.min(ormCom_precios.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormCom_precios[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
	}
	
	public void listByCriteria() throws PersistentException  {
		System.out.println("Listing Com_log by Criteria...");
		orm.Com_logCriteria lormCom_logCriteria = new orm.Com_logCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//lormCom_logCriteria.log_id_log.eq();
		lormCom_logCriteria.setMaxResults(ROW_COUNT);
		orm.Com_log[] ormCom_logs = lormCom_logCriteria.listCom_log();
		int length =ormCom_logs== null ? 0 : Math.min(ormCom_logs.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormCom_logs[i]);
		}
		System.out.println(length + " Com_log record(s) retrieved."); 
		
		System.out.println("Listing Com_precio by Criteria...");
		orm.Com_precioCriteria lormCom_precioCriteria = new orm.Com_precioCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//lormCom_precioCriteria.pre_id_precio.eq();
		lormCom_precioCriteria.setMaxResults(ROW_COUNT);
		orm.Com_precio[] ormCom_precios = lormCom_precioCriteria.listCom_precio();
		length =ormCom_precios== null ? 0 : Math.min(ormCom_precios.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormCom_precios[i]);
		}
		System.out.println(length + " Com_precio record(s) retrieved."); 
		
	}
	
	public static void main(String[] args) {
		try {
			ListPrueba1Data listPrueba1Data = new ListPrueba1Data();
			try {
				listPrueba1Data.listTestData();
				//listPrueba1Data.listByCriteria();
			}
			finally {
				orm.Prueba1PersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
